﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NF_Tools
{
    public partial class BF_DateButton :Button
    {
        public bool _IsFocus = false;//是否为当前焦点
        public BF_DateButton()
        {
            InitializeComponent();
            this.AutoSize = false;
            this.Size = new Size(60, 30);
            this.FlatStyle = FlatStyle.Flat;
            this.FlatAppearance.BorderSize = 0;
        }

        public BF_DateButton(IContainer container)
        {
            container.Add(this);
            InitializeComponent();
            this.AutoSize = false;
            this.Size = new Size(60, 30);
            this.FlatStyle = FlatStyle.Flat;
            this.FlatAppearance.BorderSize = 0;
        }

        [Category("WXP"), DisplayName("默认图标")]
        public Image Default_ICO { get; set; }

        [Category("WXP"), DisplayName("鼠标移上图标")]
        public Image Hover_ICO { get; set; }
        [Category("WXP"), DisplayName("得到焦点颜色")]
        public Color HoverColor { get; set; }

        [Category("WXP"), DisplayName("失去焦点颜色")]
        public Color LeaveColor { get; set; }

        protected override void OnMouseHover(EventArgs e)
        {
            this.BackgroundImage = Hover_ICO;
            this.ForeColor = HoverColor;
            base.OnMouseHover(e);
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            if (_IsFocus) return;
            this.BackgroundImage = Default_ICO;
            this.ForeColor = LeaveColor;
            base.OnMouseLeave(e);
        }
    }
}
